
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>关于Xcode12静态库打包的一些心得 · Summary</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-xonokai.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="剪贴板的使用.html" />
    
    
    <link rel="prev" href="我折腾的shell笔记.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                        <b>1.1.</b>
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../workflows/">
            
                <a href="../workflows/">
            
                    
                        <b>1.2.</b>
                    
                    workflows相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../workflows/iOS开发如何给自己的App增加捷径自定义拓展.html">
            
                <a href="../workflows/iOS开发如何给自己的App增加捷径自定义拓展.html">
            
                    
                        <b>1.2.1.</b>
                    
                    iOS开发如何给自己的App增加捷径自定义拓展
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../workflows/如何制作一个手机上的Github图床捷径workflow.html">
            
                <a href="../workflows/如何制作一个手机上的Github图床捷径workflow.html">
            
                    
                        <b>1.2.2.</b>
                    
                    如何制作一个手机上的Github图床捷径(workflow)
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../AppleScript/">
            
                <a href="../AppleScript/">
            
                    
                        <b>1.3.</b>
                    
                    AppleScript相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../AppleScript/关于AppleScript脚本语言的一些使用总结.html">
            
                <a href="../AppleScript/关于AppleScript脚本语言的一些使用总结.html">
            
                    
                        <b>1.3.1.</b>
                    
                    关于AppleScript脚本语言的一些使用总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../AppleScript/为Mac自带的AppleScript脚本编辑器增加代码注释快捷键.html">
            
                <a href="../AppleScript/为Mac自带的AppleScript脚本编辑器增加代码注释快捷键.html">
            
                    
                        <b>1.3.2.</b>
                    
                    为Mac自带的AppleScript脚本编辑器增加代码注释快捷键
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../AppleScript/say指令让Mac说话.html">
            
                <a href="../AppleScript/say指令让Mac说话.html">
            
                    
                        <b>1.3.3.</b>
                    
                    say指令让Mac开口说话
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="./">
            
                <a href="./">
            
                    
                        <b>1.4.</b>
                    
                    Shell相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="我折腾的shell笔记.html">
            
                <a href="我折腾的shell笔记.html">
            
                    
                        <b>1.4.1.</b>
                    
                    我折腾的shell笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.2" data-path="关于Xcode12静态库打包的一些心得.html">
            
                <a href="关于Xcode12静态库打包的一些心得.html">
            
                    
                        <b>1.4.2.</b>
                    
                    关于Xcode12静态库打包的一些心得
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="剪贴板的使用.html">
            
                <a href="剪贴板的使用.html">
            
                    
                        <b>1.4.3.</b>
                    
                    剪贴板的使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="指定入参的使用.html">
            
                <a href="指定入参的使用.html">
            
                    
                        <b>1.4.4.</b>
                    
                    指定入参的使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../git-about/">
            
                <a href="../git-about/">
            
                    
                        <b>1.5.</b>
                    
                    git相关
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../git-about/git使用技巧总结.html">
            
                <a href="../git-about/git使用技巧总结.html">
            
                    
                        <b>1.5.1.</b>
                    
                    git使用技巧总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >关于Xcode12静态库打包的一些心得</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5173;&#x4E8E;xcode12&#x9759;&#x6001;&#x5E93;&#x6253;&#x5305;&#x7684;&#x4E00;&#x4E9B;&#x5FC3;&#x5F97;">&#x5173;&#x4E8E;Xcode12&#x9759;&#x6001;&#x5E93;&#x6253;&#x5305;&#x7684;&#x4E00;&#x4E9B;&#x5FC3;&#x5F97;</h1>
<ul>
<li><a href="#&#x7F16;&#x8BD1;a&#x7684;&#x811A;&#x672C;&#x5982;&#x4E0B;&#x91C7;&#x7528;&#x624B;&#x52A8;&#x7F16;&#x8BD1;&#x811A;&#x672C;&#x5408;&#x6210;">&#x7F16;&#x8BD1;.a&#x7684;&#x811A;&#x672C;&#x5982;&#x4E0B;(&#x91C7;&#x7528;&#x624B;&#x52A8;&#x7F16;&#x8BD1; &#x811A;&#x672C;&#x5408;&#x6210;):</a></li>
<li><a href="#&#x7F16;&#x8BD1;framework&#x4E0E;a&#x7C7B;&#x4F3C;">&#x7F16;&#x8BD1;framework&#x4E0E;.a&#x7C7B;&#x4F3C;</a></li>
<li><a href="#&#x66F4;&#x65B0;&#x4E8E;2020-01-11">&#x66F4;&#x65B0;&#x4E8E;2020-01-11</a></li>
<li><a href="#-all_load---force_load---objc-&#x7684;&#x533A;&#x522B;&#x548C;&#x5999;&#x7528;">-all_load , -force_load , -ObjC &#x7684;&#x533A;&#x522B;&#x548C;&#x5999;&#x7528;</a></li>
<li><a href="#&#x4E00;&#x4E9B;&#x76F8;&#x5173;&#x6587;&#x7AE0;">&#x4E00;&#x4E9B;&#x76F8;&#x5173;&#x6587;&#x7AE0;</a></li>
</ul>
<blockquote>
<p>&#x6700;&#x8FD1;&#x5728;&#x73A9;&#x9759;&#x6001;&#x5E93;&#x6253;&#x5305;,&#x65F6;&#x4E0D;&#x65F6;&#x9047;&#x5230;&#x5982;&#x4E0B;&#x8FD9;&#x79CD;&#x62A5;&#x9519;,&#x53EF;&#x80FD;&#x662F;Xcode&#x5347;&#x7EA7;&#x7684;&#x7F18;&#x6545;,&#x4E4B;&#x524D;&#x662F;&#x6CA1;&#x6709;&#x9047;&#x5230;&#x8FC7;,&#x6545;&#x6B64;&#x603B;&#x7ED3;&#x4E86;&#x4E00;&#x6CE2;...</p>
</blockquote>
<p> <code>Building for iOS Simulator, but the linked library &apos;libxxx.a&apos; was built for iOS.</code></p>
<p> &#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x662F;&#x56E0;&#x4E3A;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x7684;&#x90A3;&#x4E2A;<code>.a</code>&#x6CA1;&#x6709;&#x5408;&#x5E76;,&#x53EA;&#x662F;&#x6253;&#x4E86;&#x771F;&#x673A;&#x7684;<code>.a</code>,&#x8FD0;&#x884C;&#x5230;&#x6A21;&#x62DF;&#x5668;&#x800C;&#x6A21;&#x62DF;&#x5668;&#x662F;<code>x86_64</code>&#x7684;&#x67B6;&#x6784;,&#x5982;&#x679C;&#x4E0D;&#x9700;&#x8981;&#x6A21;&#x62DF;&#x5668;&#x8C03;&#x8BD5;,&#x76F4;&#x63A5;&#x771F;&#x673A;&#x7684;&#x5373;&#x53EF;</p>
<p>&#x53E6;: &#x6A21;&#x62DF;&#x5668;&#x6253;&#x5305;&#x4E0E;&#x771F;&#x673A;&#x7684;&#x5305;&#x65E0;&#x6CD5;&#x5408;&#x5E76;,&#x51FA;&#x73B0;arm64&#x91CD;&#x590D;,&#x65E0;&#x6CD5;&#x5408;&#x5E76;&#x4E3A;fat&#x7684;&#x95EE;&#x9898;
 <code>Build settings-&gt;Excluded Architectures</code>&#x91CC;&#x5FFD;&#x7565;&#x5F53;&#x524D;<code>SDK</code>&#x4E0D;&#x652F;&#x6301;&#x7684;&#x67B6;&#x6784;
 &#x6A21;&#x62DF;&#x5668;SDK&#x4E0B;&#x53EF;&#x4EE5;&#x5FFD;&#x7565;&#x771F;&#x673A;&#x7684;&#x67B6;&#x6784;<code>arm64</code>,<code>arm64e</code>,&#x5176;&#x5B9E;&#x4E0D;&#x9002;&#x914D;5s&#x4EE5;&#x4E0B;&#x7684;&#x8BDD;&#x76F4;&#x63A5;&#x628A;i386&#x4E5F;&#x53BB;&#x6389;&#x4E5F;&#x662F;&#x53EF;&#x4EE5;&#x7684;,&#x540C;&#x6837;&#x771F;&#x673A;&#x4E5F;&#x53EF;&#x53BB;&#x6389;armv7&#x548C;armv7s,&#x8FD9;&#x6837;&#x505A;&#x7684;&#x597D;&#x5904;&#x662F;&#x53EF;&#x4EE5;&#x51CF;&#x5C0F;&#x5305;&#x4F53;&#x79EF;</p>
<p>&#x73B0;&#x5728;&#x65B0;iPhone X&#x4EE5;&#x4E0A;iPhone 11 iPhone12&#x7B49;&#x652F;&#x6301;&#x65B0;&#x67B6;&#x6784;&#x5F97;&#x52A0;&#x4E00;&#x4E2A;<code>arm64e</code>,&#x5728;<code>Architectures</code>&#x91CC;&#x7684;<code>other</code>&#x91CC;&#x624B;&#x52A8;&#x6DFB;&#x52A0;&#x5373;&#x53EF;</p>
<p> &#x6240;&#x4EE5;&#x76EE;&#x524D;&#x89E3;&#x51B3;&#x529E;&#x6CD5;&#x5C31;&#x662F;&#x6253;&#x591A;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x9759;&#x6001;&#x5E93; 
 &#x6BD4;&#x5982;:  </p>
<ul>
<li>&#x5168;&#x91CF;&#x5305; i386,x86_64,armv7,armv7s,arm64,arm64e </li>
<li>&#x62C6;&#x5206;&#x5305;<ul>
<li>&#x771F;&#x673A;&#x548C;&#x6A21;&#x62DF;&#x5668;&#x7684;&#x62C6;&#x5206;<ul>
<li>&#x6A21;&#x62DF;&#x5668; i386,x86_64</li>
<li>&#x771F;&#x673A; armv7,armv7s,arm64,arm64e </li>
</ul>
</li>
<li>&#x6BCF;&#x4E00;&#x79CD;&#x67B6;&#x6784;&#x5355;&#x72EC;&#x62CE;&#x51FA;&#x6765;,lipo&#x547D;&#x4EE4;&#x81EA;&#x5DF1;&#x6309;&#x9700;&#x5408;&#x5E76; </li>
</ul>
</li>
</ul>
<p>&#x4E00;&#x822C;&#x6765;&#x8BF4;,&#x5F00;&#x53D1;&#x8C03;&#x8BD5;&#x7684;&#x8BDD;&#x5C31;&#x7528;&#x5168;&#x91CF;&#x5305;,&#x53D1;&#x5E03;&#x4E0A;&#x7EBF;&#x7528;&#x771F;&#x673A;&#x5305;</p>
<p><strong>&#x8BB2;&#x9053;&#x7406;,&#x4E00;&#x4E9B;&#x65E7;&#x8BBE;&#x5907;&#x90FD;&#x88AB;&#x7CFB;&#x7EDF;&#x6240;&#x6DD8;&#x6C70;&#x4E86;,iOS10&#x8D77;&#x6B65;&#x652F;&#x6301;iPhone 5s&#x4EE5;&#x4E0A;,&#x90A3;&#x5C31;&#x5927;&#x53EF;&#x4E0D;&#x5FC5;&#x652F;&#x6301;i386&#x548C;armv7,&#x76F4;&#x63A5;arm64&#x548C;x86_64&#x5373;&#x53EF;,&#x4E0A;&#x7EBF;&#x6253;&#x5305;&#x53EF;&#x4EE5;&#x5254;&#x9664;x86_64,&#x8FD9;&#x6837;&#x624D;&#x662F;&#x6700;&#x4F18;&#x89E3;</strong></p>
<h2 id="&#x7F16;&#x8BD1;a&#x7684;&#x811A;&#x672C;&#x5982;&#x4E0B;&#x91C7;&#x7528;&#x624B;&#x52A8;&#x7F16;&#x8BD1;&#x811A;&#x672C;&#x5408;&#x6210;">&#x7F16;&#x8BD1;.a&#x7684;&#x811A;&#x672C;&#x5982;&#x4E0B;(&#x91C7;&#x7528;&#x624B;&#x52A8;&#x7F16;&#x8BD1;+&#x811A;&#x672C;&#x5408;&#x6210;):</h2>
<p> ps: &#x81EA;&#x52A8;&#x7F16;&#x8BD1;&#x5728;Xcode12.3&#x4E0D;&#x77E5;&#x9053;&#x51FA;&#x4E86;&#x4EC0;&#x4E48;&#x9B3C;,xcodebuild&#x4E00;&#x76F4;&#x6B7B;&#x5FAA;&#x73AF;&#x5C31;&#x662F;&#x7F16;&#x8BD1;&#x4E0D;&#x8FC7;,&#x65E0;&#x5948;&#x4E4B;&#x4E0B;&#x91C7;&#x53D6;&#x534A;&#x81EA;&#x52A8;&#x4E86;,&#x4E0D;&#x8FC7;&#x914D;&#x5408;say&#x8BED;&#x97F3;&#x63D0;&#x793A;&#x4E5F;&#x662F;&#x53EF;&#x4EE5;&#x7684;</p>
<pre class="language-"><code class="lang-bash"><span class="token shebang important">#! /bin/sh</span>
<span class="token comment"># &#x5148;&#x5728;&#x5DE5;&#x7A0B;&#x6839;&#x76EE;&#x5F55;&#x521B;&#x5EFA;&#x597D;SDK&#x6587;&#x4EF6;&#x5939;</span>
<span class="token function">mkdir</span> -p <span class="token variable">${PROJECT_NAME}</span>_SDK
<span class="token builtin class-name">cd</span> <span class="token variable">${PROJECT_NAME}</span>_SDK
<span class="token function">mkdir</span> -p <span class="token variable">${PROJECT_NAME}</span>
<span class="token builtin class-name">cd</span> <span class="token variable">${PROJECT_NAME}</span>
<span class="token function">mkdir</span> -p include
<span class="token function">mkdir</span> -p lib

<span class="token comment">#&#x56DE;&#x5230;&#x5DE5;&#x7A0B;&#x76EE;&#x5F55;</span>
<span class="token builtin class-name">cd</span> ./<span class="token punctuation">..</span>/<span class="token punctuation">..</span>/
<span class="token comment">#&#x771F;&#x673A;build&#x751F;&#x6210;&#x7684;.a&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</span>
<span class="token assign-left variable">DEVICE_DIR_A</span><span class="token operator">=</span><span class="token variable">${BUILD_DIR}</span>/<span class="token variable">${CONFIGURATION}</span>-iphoneos/lib<span class="token variable">${PROJECT_NAME}</span>.a
<span class="token comment">#&#x6A21;&#x62DF;&#x5668;build&#x751F;&#x6210;&#x7684;.a&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</span>
<span class="token assign-left variable">SIMULATOR_DIR_A</span><span class="token operator">=</span><span class="token variable">${BUILD_DIR}</span>/<span class="token variable">${CONFIGURATION}</span>-iphonesimulator/lib<span class="token variable">${PROJECT_NAME}</span>.a

<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -f <span class="token string">&quot;<span class="token variable">${DEVICE_DIR_A}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
    say <span class="token string">&quot;&#x771F;&#x673A;&#x7F16;&#x8BD1;&#x5B8C;&#x6210;&quot;</span>
<span class="token keyword">fi</span>

<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -f <span class="token string">&quot;<span class="token variable">${SIMULATOR_DIR_A}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
    say <span class="token string">&quot;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x5B8C;&#x6210;&quot;</span>
<span class="token keyword">fi</span>

<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -f <span class="token string">&quot;<span class="token variable">${DEVICE_DIR_A}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token punctuation">;</span> <span class="token keyword">then</span>
    <span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -f <span class="token string">&quot;<span class="token variable">${SIMULATOR_DIR_A}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
        lipo -create <span class="token variable">${DEVICE_DIR_A}</span> <span class="token variable">${SIMULATOR_DIR_A}</span> -output ./<span class="token variable">${PROJECT_NAME}</span>_SDK/<span class="token variable">${PROJECT_NAME}</span>/lib/lib<span class="token variable">${PROJECT_NAME}</span>.a
        <span class="token comment">#&#x5934;&#x6587;&#x4EF6;&#x8F6C;&#x79FB;&#x5927;&#x6CD5;</span>
        <span class="token assign-left variable">HEADER_FOLDER</span><span class="token operator">=</span><span class="token string">&quot;<span class="token variable">${BUILD_DIR}</span>/<span class="token variable">${CONFIGURATION}</span>-iphoneos/include/<span class="token variable">${PROJECT_NAME}</span>&quot;</span>
        <span class="token function">cp</span> -a <span class="token variable">${HEADER_FOLDER}</span>/. ./<span class="token variable">${PROJECT_NAME}</span>_SDK/<span class="token variable">${PROJECT_NAME}</span>/include
        <span class="token function">open</span> ./
        say <span class="token string">&quot;&#x9759;&#x6001;&#x5E93;&#x5408;&#x5E76;&#x6210;&#x529F;&quot;</span>
    <span class="token keyword">fi</span>
<span class="token keyword">fi</span>
</code></pre>
<video controls width="720" height="480" loop preload="auto" webkit-playsinline="true" playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="true" x-webkit-airplay="allow" x5-video-orientation="portraint" style="object-fit:fill">
        <source src="https://cdn.jsdelivr.net/gh/WangGuibin/MyFilesRepo/images/1610240744.mp4" type="video/mp4">
</video>

<h2 id="&#x7F16;&#x8BD1;framework&#x4E0E;a&#x7C7B;&#x4F3C;">&#x7F16;&#x8BD1;framework&#x4E0E;.a&#x7C7B;&#x4F3C;</h2>
<pre class="language-"><code class="lang-bash"><span class="token shebang important">#! /bin/sh</span>
<span class="token comment">#&#x521B;&#x5EFA;&#x5B58;&#x653E;&#x76EE;&#x5F55;</span>
<span class="token function">mkdir</span> -p <span class="token variable">${PROJECT_NAME}</span>.framework
<span class="token assign-left variable">INSTALL_DIR</span><span class="token operator">=</span>./<span class="token variable">${PROJECT_NAME}</span>.framework

<span class="token comment">#&#x771F;&#x673A;&#x7F16;&#x8BD1;&#x4EA7;&#x7269;</span>
<span class="token assign-left variable">DEVICE_DIR</span><span class="token operator">=</span><span class="token variable">${BUILD_DIR}</span>/<span class="token variable">${CONFIGURATION}</span>-iphoneos/<span class="token variable">${PROJECT_NAME}</span>.framework
<span class="token comment">#&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x4EA7;&#x7269;</span>
<span class="token assign-left variable">SIMULATOR_DIR</span><span class="token operator">=</span><span class="token variable">${BUILD_DIR}</span>/<span class="token variable">${CONFIGURATION}</span>-iphonesimulator/<span class="token variable">${PROJECT_NAME}</span>.framework

<span class="token comment">#.framework&#x662F;&#x76EE;&#x5F55;&#x662F;&#x6587;&#x4EF6;&#x5939; &#x6240;&#x4EE5;&#x7528;-d&#x5224;&#x65AD; &#x6587;&#x4EF6;&#x7528;-f</span>
<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -d <span class="token string">&quot;<span class="token variable">$DEVICE_DIR</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
    say <span class="token string">&quot;&#x771F;&#x673A;&#x7F16;&#x8BD1;&#x5B8C;&#x6210;&quot;</span>
<span class="token keyword">fi</span>

<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -d <span class="token string">&quot;<span class="token variable">$SIMULATOR_DIR</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
    say <span class="token string">&quot;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x5B8C;&#x6210;&quot;</span>
<span class="token keyword">fi</span>

<span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -d <span class="token string">&quot;<span class="token variable">${DEVICE_DIR}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span> <span class="token punctuation">;</span> <span class="token keyword">then</span>
    <span class="token keyword">if</span> <span class="token punctuation">[</span><span class="token punctuation">[</span> -d <span class="token string">&quot;<span class="token variable">${SIMULATOR_DIR}</span>&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">;</span> <span class="token keyword">then</span>
        <span class="token function">cp</span> -R <span class="token variable">${DEVICE_DIR}</span>/ <span class="token variable">${INSTALL_DIR}</span>/
        lipo -create <span class="token string">&quot;<span class="token variable">${DEVICE_DIR}</span>/<span class="token variable">${PROJECT_NAME}</span>&quot;</span> <span class="token string">&quot;<span class="token variable">${SIMULATOR_DIR}</span>/<span class="token variable">${PROJECT_NAME}</span>&quot;</span> -output <span class="token string">&quot;<span class="token variable">${INSTALL_DIR}</span>/<span class="token variable">${PROJECT_NAME}</span>&quot;</span>
        <span class="token function">open</span> ./
        say <span class="token string">&quot;&#x9759;&#x6001;&#x5E93;&#x5408;&#x5E76;&#x6210;&#x529F;&quot;</span>
    <span class="token keyword">fi</span>
<span class="token keyword">fi</span>
</code></pre>
<video width="720" height="480" controls loop preload="auto" webkit-playsinline="true" playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="true" x-webkit-airplay="allow" x5-video-orientation="portraint" style="object-fit:fill">
        <source src="https://cdn.jsdelivr.net/gh/WangGuibin/MyFilesRepo/images/1610240648.mp4" type="video/mp4">
</video>


<h2 id="&#x66F4;&#x65B0;&#x4E8E;2020-01-11">&#x66F4;&#x65B0;&#x4E8E;2020-01-11</h2>
<p>&#x6709;&#x65F6;&#x5019;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x5931;&#x8D25;&#x800C;&#x62A5;&#x9519;
<code>The linked library &apos;xxxx.a/Framework&apos; is missing one or more architectures required by this target: armv7/&#x6216;&#x8005;&#x662F;x86_64</code>
&#x771F;&#x673A;SDK&#x7F16;&#x8BD1;&#x6A21;&#x62DF;&#x5668;&#x6216;&#x8005;&#x662F;&#x6A21;&#x62DF;&#x5668;SDK&#x7F16;&#x8BD1;&#x771F;&#x673A;,<code>lipo -info xxx</code>&#x67E5;&#x770B;&#x67B6;&#x6784;&#x6392;&#x9664;&#x539F;&#x56E0;
&#x2460; &#x5982;&#x679C;&#x662F;&#x6CA1;&#x6709;&#x5408;&#x5E76;,&#x5219;&#x9700;&#x8981;&#x5408;&#x5E76;
&#x2461; &#x5982;&#x679C;&#x5DF2;&#x5408;&#x5E76;,&#x5219;&#x9700;&#x8981;&#x5DEE;&#x5F02;&#x5316;&#x6392;&#x9664;</p>
<p>&#x5728;TARGETS &#x2014;&#x2014;&gt; Build Settings-Excluded Architectures &#x6DFB;&#x52A0;&#x5982;&#x4E0B;&#x4EE3;&#x7801;:</p>
<pre class="language-"><code class="lang-objc">EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))
</code></pre>
<p>&#x9009;&#x62E9;&#x6A21;&#x62DF;&#x5668;SDK&#x7F16;&#x8BD1;&#x7684;&#x65F6;&#x5019;,&#x6392;&#x9664;&#x771F;&#x673A;&#x67B6;&#x6784;,&#x540C;&#x7406;,&#x7F16;&#x8BD1;&#x771F;&#x673A;SDK&#x65F6;,&#x6392;&#x9664;&#x6A21;&#x62DF;&#x5668;&#x7684;&#x67B6;&#x6784;,<code>Excluded</code>&#x662F;&#x6392;&#x9664;&#x7684;&#x610F;&#x601D;. &#x62F7;&#x8D1D;&#x4E0A;&#x9762;&#x8FD9;&#x53E5;&#x4EE3;&#x7801;&#x5F80;&#x4E0A;&#x4E00;&#x7C98;&#x5C31;&#x5B8C;&#x4E8B;&#x4E86;</p>
<h2 id="allload---forceload---objc-&#x7684;&#x533A;&#x522B;&#x548C;&#x5999;&#x7528;">-all_load , -force_load , -ObjC &#x7684;&#x533A;&#x522B;&#x548C;&#x5999;&#x7528;</h2>
<ol>
<li><code>-all_load</code> &#x94FE;&#x63A5;&#x5668;&#x628A;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x90FD;&#x52A0;&#x8F7D;&#x8FDB;&#x6765;,&#x4E0D;&#x80FD;&#x8349;&#x7387;&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;,&#x9879;&#x76EE;&#x5F88;&#x5927;&#x6216;&#x8005;&#x4F9D;&#x8D56;&#x7684;&#x5E93;&#x5F88;&#x591A;&#x53EF;&#x80FD;&#x4F1A;&#x51FA;&#x73B0;&#x51B2;&#x7A81;,&#x63D0;&#x793A;&#x91CD;&#x590D;&#x4F9D;&#x8D56;&#x4E4B;&#x7C7B;&#x7684;&#x9519;&#x8BEF;,&#x5728;&#x77E5;&#x9053;&#x5404;&#x4E2A;&#x5E93;&#x4F7F;&#x7528;&#x60C5;&#x51B5;&#x4E4B;&#x4E0B;,&#x6700;&#x597D;&#x662F;&#x4F7F;&#x7528;<code>-force_load</code>&#x4E00;&#x4E2A;&#x4E2A;&#x6307;&#x5B9A;&#x5E93;&#x6587;&#x4EF6;&#x53BB;&#x52A0;&#x8F7D;. </li>
<li><code>-force_load</code> &#x4E0E;<code>-all_load</code>&#x7528;&#x6CD5;&#x7C7B;&#x4F3C;,&#x6307;&#x5B9A;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x52A0;&#x8F7D;</li>
<li><code>-ObjC</code>&#x7528;&#x4E8E;&#x52A0;&#x8F7D;&#x5206;&#x7C7B;category,&#x7C7B;&#x548C;&#x5206;&#x7C7B;&#x540C;&#x65F6;&#x5B58;&#x5728;&#x4E8E;&#x9759;&#x6001;&#x5E93;&#x65F6;&#x4F7F;&#x7528;<code>-ObjC</code>&#x6CA1;&#x6BDB;&#x75C5;,&#x4F46;&#x662F;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5305;&#x542B;&#x7C7B;&#x5BF9;&#x8C61;,&#x4EC5;&#x4EC5;&#x53EA;&#x662F;category&#x662F;&#x52A0;&#x8F7D;&#x4E0D;&#x8FDB;&#x53BB;&#x7684;,&#x5982;&#x679C;&#x4EC0;&#x4E48;&#x90FD;&#x4E0D;&#x52A0;,&#x9759;&#x6001;&#x5E93;&#x4E2D;&#x7684;category&#x5728;&#x5916;&#x90E8;&#x8C03;&#x7528;&#x7684;&#x65F6;&#x5019;&#x4F1A;&#x76F4;&#x63A5;&#x62A5;&#x9519;: unrecognized selector xxx , &#x4E00;&#x822C;&#x60C5;&#x51B5;&#x90FD;&#x662F;&#x914D;&#x5408; <code>-all_load</code> &#x548C; <code>-force_load</code>&#x4E00;&#x8D77;&#x4F7F;&#x7528;. </li>
</ol>
<h2 id="&#x4E00;&#x4E9B;&#x76F8;&#x5173;&#x6587;&#x7AE0;">&#x4E00;&#x4E9B;&#x76F8;&#x5173;&#x6587;&#x7AE0;</h2>
<ul>
<li><a href="https://blog.lessney.com/blog/2020/05/22/&#x89E3;&#x51B3;-Xcode-11-4-&#x4EE5;&#x6765;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x62A5;&#x9519;-Building-for-iOS-Simulator-but-the-linked-library-was-built-for-iOS-&#x7684;&#x6B63;&#x786E;&#x59FF;&#x52BF;/" target="_blank">&#x89E3;&#x51B3;-Xcode-11-4-&#x4EE5;&#x6765;&#x6A21;&#x62DF;&#x5668;&#x7F16;&#x8BD1;&#x62A5;&#x9519;-Building-for-iOS-Simulator-but-the-linked-library-was-built-for-iOS-&#x7684;&#x6B63;&#x786E;&#x59FF;&#x52BF;</a></li>
<li><a href="https://www.jianshu.com/p/5f896321b1ea" target="_blank">Xcode 12 - Architecture&#x76F8;&#x5173;&#x95EE;&#x9898;</a></li>
<li><a href="https://www.jianshu.com/p/461edde66d02" target="_blank">iOS CPU&#x67B6;&#x6784;(ARM&#x6307;&#x4EE4;&#x96C6;)</a></li>
<li><a href="https://juejin.cn/post/6844903859731578887" target="_blank">iOS &#x6253;&#x5305;&#x79FB;&#x9664; i386 &#x548C; x86_64 &#x5E73;&#x53F0;&#x52A8;&#x6001;&#x5E93;</a></li>
<li><a href="https://www.cnblogs.com/YueHeiZS/p/9252186.html" target="_blank">Python&#x5C0F;&#x5DE5;&#x5177;: &#x53BB;&#x9664;iOS&#x9759;&#x6001;&#x5E93;(.a&#x6216;.framework)&#x6A21;&#x62DF;&#x5668;&#x67B6;&#x6784;&#x4EE3;&#x7801;</a></li>
<li><a href="https://my.oschina.net/jack088/blog/4882667" target="_blank">Xcode&#x5347;&#x7EA7;12&#x7F16;&#x8BD1;&#x62A5;&#x9519;The linked library is missing one or more architectures required by this target</a><hr><div id="vcomments"></div><script src="//unpkg.com/valine/dist/Valine.min.js"></script><script>new Valine({el: "#vcomments",appId: 'oT5vWHkWT1JN1o5aXiSqYGtH-gzGzoHsz',appKey: 'V7zBLpzBgxVESicbyF072Cj9',placeholder: 'Just go go',avatar: '',meta: undefined,pageSize: 10,lang: 'zh-CN',recordIP: false})</script> </li>
</ul>
<footer class="page-footer"><span class="copyright">CoderWGB all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x7AE0;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2021-01-31 20:57:10
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="我折腾的shell笔记.html" class="navigation navigation-prev " aria-label="Previous page: 我折腾的shell笔记">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="剪贴板的使用.html" class="navigation navigation-next " aria-label="Next page: 剪贴板的使用">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"关于Xcode12静态库打包的一些心得","level":"1.4.2","depth":2,"next":{"title":"剪贴板的使用","level":"1.4.3","depth":2,"path":"books/Shell/剪贴板的使用.md","ref":"./books/Shell/剪贴板的使用.md","articles":[]},"previous":{"title":"我折腾的shell笔记","level":"1.4.1","depth":2,"path":"books/Shell/我折腾的shell笔记.md","ref":"./books/Shell/我折腾的shell笔记.md","articles":[]},"dir":"ltr"},"config":{"plugins":["back-to-top-button","chapter-fold","code","copy-code-button","splitter","valine","-lunr","-search","search-pro","insert-logo","custom-favicon","pageview-count","tbfed-pagefooter","popup","-sharing","sharing-plus","-highlight","prism","prism-themes","simple-page-toc"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"CoderWGB","modify_label":"该文章修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{"css":["prism-themes/themes/prism-xonokai.css"]},"simple-page-toc":{"maxDepth":3,"skipFirstH1":true},"splitter":{},"search-pro":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"popup":{},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"favicon":"./logo.ico","back-to-top-button":{},"pageview-count":{},"prism-themes":{},"custom-favicon":{},"copy-code-button":{},"sharing":{"qq":true,"all":["douban","facebook","google","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","whatsapp"],"douban":true,"facebook":true,"weibo":true,"twitter":true,"pocket":true,"google":true,"qzone":true},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"insert-logo":{"style":"background: none; max-height: 30px; min-height: 30px","url":"https://cdn.jsdelivr.net/gh/WangGuibin/MyFilesRepo/images/20210130164238.png"},"valine":{"avatar":"","lang":"zh-CN","pageSize":10,"placeholder":"Just go go","recordIP":false,"appId":"oT5vWHkWT1JN1o5aXiSqYGtH-gzGzoHsz","appKey":"V7zBLpzBgxVESicbyF072Cj9"}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Summary","gitbook":"*"},"file":{"path":"books/Shell/关于Xcode12静态库打包的一些心得.md","mtime":"2021-01-31T12:57:10.424Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-01-31T13:01:17.483Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

